// https://www.qimai.cn/rank/index/brand/all/device/iphone/country/cn/genre/36

params = {
    "brand": "free",
    "device": "iphone",
    "country": "cn",
    "genre": "36",
    "date": "2023-11-09",
    "page": 1,
    "is_rank_index": 1,
    "snapshot": null
}

/**
 * 获取请求加密数据
 * @param param
 * @param url
 * @returns {*}
 */
function encrypt_data(param,url) {
    baseUrl = "https://api.qimai.cn"
    a = []
    for (let key in param){
        a.push(param[key])
    }
    a = a.sort().join("")
    a = (0, v)(a)

    vv = "@#"
    rr = new Date()  - (379 || 0) - 1661224081041

    a = (a += vv + url.replace(baseUrl,"")) + (vv + rr) + (vv + 3),
    e = (0, v)((0, h)(a, "xyz517cda96efgh"))
    return e
}

function v(t) {
    t = encodeURIComponent(t).replace(/%([0-9A-F]{2})/g, function (n, t) {
        return o("0x" + t)
    });
    try {
        return btoa(t)
    } catch (n) {
        return z[W1][K1](t)[U1](Z1)
    }
}

function o(n) {
    t = "",
        [
            "66",
            "72",
            "6f",
            "6d",
            "43",
            "68",
            "61",
            "72",
            "43",
            "6f",
            "64",
            "65"
        ].forEach(function (n) {
            t += unescape("%u00" + n)
        });
    var t, e = t;
    return String.fromCharCode(n)
}

function h(n, t) {
    t = t || u();
    for (var e = (n = n.split("")).length, r = t.length, a = "charCodeAt", i = 0; i < e; i++)
        n[i] = o(n[i][a](0) ^ t[(i + 10) % r][a](0));
    return n.join("")
}

